package org.jeecg.common.system.api;

import com.alibaba.fastjson.JSONObject;
import org.jeecg.common.api.dto.message.MsgDTO;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.ServiceNameConstants;
import org.jeecg.common.system.api.factory.SysBaseAPIFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

/**
 * 相比较local版
 * 去掉了一些方法：
 * addLog getDatabaseType queryAllDepart
 * queryAllUser(Wrapper wrapper) queryAllUser(String[] userIds, int pageNo, int pageSize)
 * 修改了一些方法：
 * createLog
 * sendSysAnnouncement 只保留了一个，其余全部干掉
 * <p>
 * cloud接口数量43  local：35 common：9  额外一个特殊queryAllRole一个当两个用
 */
@Component
@FeignClient(contextId = "apiCenterRemoteApi", path = "apiCenter/uir", value = ServiceNameConstants.JEECG_APICENTER, fallbackFactory = SysBaseAPIFallbackFactory.class)
public interface ApiCenterFeign {

    @PostMapping(value = "/msgPublish")
    Result<JSONObject> sendAnnouncement(@RequestBody MsgDTO msgDTO, @RequestHeader MultiValueMap<String, String> headers);

    @PostMapping(value = "/msgReaded")
    Result<JSONObject> msgReadedAnnouncement(@RequestBody JSONObject jsonObject, @RequestHeader MultiValueMap<String, String> headers);
}
